﻿<phone:PhoneApplicationPage
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
	xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
	xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
	xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" 
	xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit" xmlns:local="clr-namespace:LunchRoller" 
	xmlns:toolkitPrimitives="clr-namespace:Microsoft.Phone.Controls.Primitives;assembly=Microsoft.Phone.Controls.Toolkit" 
	xmlns:SmartMad_Ads_WindowsPhone7_WPF="clr-namespace:SmartMad.Ads.WindowsPhone7.WPF;assembly=SmartMad.Ads.WindowsPhone7" 
	x:Class="LunchRoller.MainPage" 
	mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="728" 
	d:DataContext="{d:DesignData SampleData/MainViewModelSampleData.xaml}"
	SupportedOrientations="Portrait"  Orientation="Portrait"
	shell:SystemTray.IsVisible="False"  shell:SystemTray.Opacity="0">
	<phone:PhoneApplicationPage.Resources>




		<Style TargetType="toolkit:ToggleSwitch">
			<Setter Property="Background" Value="{StaticResource PhoneBackgroundBrush}"/>
			<Setter Property="FontFamily" Value="{StaticResource PhoneFontFamilyLight}"/>
			<Setter Property="FontSize" Value="{StaticResource PhoneFontSizeLarge}"/>
			<Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
			<Setter Property="IsTabStop" Value="False"/>
			<Setter Property="HorizontalContentAlignment" Value="Left"/>
			<Setter Property="SwitchForeground" Value="{StaticResource PhoneAccentBrush}"/>
			<Setter Property="VerticalContentAlignment" Value="Top"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="toolkit:ToggleSwitch">
						<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CacheMode="BitmapCache" Padding="{TemplateBinding Padding}">
							<VisualStateManager.VisualStateGroups>
								<VisualStateGroup x:Name="CommonStates">
									<VisualState x:Name="Normal"/>
									<VisualState x:Name="Disabled">
										<Storyboard>
											<DoubleAnimation Duration="0" To="0.3" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="Header"/>
											<DoubleAnimation Duration="0" To="0.3" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="Content"/>
										</Storyboard>
									</VisualState>
								</VisualStateGroup>
							</VisualStateManager.VisualStateGroups>
							<Grid Margin="12,5,36,42">
								<Grid.ColumnDefinitions>
									<ColumnDefinition Width="*"/>
									<ColumnDefinition Width="Auto"/>
								</Grid.ColumnDefinitions>
								<Grid.RowDefinitions>
									<RowDefinition Height="Auto"/>
									<RowDefinition Height="Auto"/>
								</Grid.RowDefinitions>
								<ContentControl x:Name="Header" ContentTemplate="{TemplateBinding HeaderTemplate}" Content="{TemplateBinding Header}" Foreground="{StaticResource PhoneBorderBrush}" FontSize="{StaticResource PhoneFontSizeNormal}" FontFamily="{StaticResource PhoneFontFamilyNormal}" HorizontalAlignment="Left" IsTabStop="False" Margin="-1,0,0,0" Opacity="{TemplateBinding Opacity}" VerticalAlignment="Bottom"/>
								<ContentControl x:Name="Content" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" IsTabStop="False" Margin="-1,-1.5,0,0" Opacity="{TemplateBinding Opacity}" Grid.Row="1" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" d:LayoutOverrides="VerticalMargin"/>
								<toolkitPrimitives:ToggleSwitchButton x:Name="Switch" Background="{TemplateBinding Background}" Grid.Column="1" Margin="-22,0,-24,-22" Opacity="{TemplateBinding Opacity}" Grid.RowSpan="2" SwitchForeground="{TemplateBinding SwitchForeground}" VerticalAlignment="Bottom" Height="86" RenderTransformOrigin="0.5,0.43">
									<toolkitPrimitives:ToggleSwitchButton.RenderTransform>
										<CompositeTransform ScaleX="0.65" ScaleY="0.55"/>
									</toolkitPrimitives:ToggleSwitchButton.RenderTransform>
								</toolkitPrimitives:ToggleSwitchButton>
							</Grid>
						</Border>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
		<Style x:Key="PanoramaItemStyle1" TargetType="controls:PanoramaItem">
			<Setter Property="CacheMode" Value="BitmapCache"/>
			<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
			<Setter Property="VerticalContentAlignment" Value="Stretch"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="controls:PanoramaItem">
						<Grid Background="{TemplateBinding Background}" Margin="12,0,0,0">
							<Grid.RowDefinitions>
								<RowDefinition Height="auto" MinHeight="62"/>
								<RowDefinition/>
							</Grid.RowDefinitions>
							<ContentControl x:Name="header" ContentTemplate="{TemplateBinding HeaderTemplate}" Content="{TemplateBinding Header}" FontFamily="{StaticResource PhoneFontFamilySemiLight}" HorizontalAlignment="Left" Margin="10,-2,0,0" FontSize="64">
								<ContentControl.RenderTransform>
									<TranslateTransform x:Name="headerTransform"/>
								</ContentControl.RenderTransform>
							</ContentControl>
							<ContentPresenter Content="{TemplateBinding Content}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" Grid.Row="1" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
						</Grid>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>




	</phone:PhoneApplicationPage.Resources>

	<phone:PhoneApplicationPage.FontFamily>
		<StaticResource ResourceKey="PhoneFontFamilyNormal"/>
	</phone:PhoneApplicationPage.FontFamily>
	<phone:PhoneApplicationPage.FontSize>
		<StaticResource ResourceKey="PhoneFontSizeNormal"/>
	</phone:PhoneApplicationPage.FontSize>
	<phone:PhoneApplicationPage.Foreground>
		<StaticResource ResourceKey="ForeColor"/>
	</phone:PhoneApplicationPage.Foreground>

    <toolkit:TransitionService.NavigationInTransition>
        <toolkit:NavigationInTransition>
            <toolkit:NavigationInTransition.Backward>
                <toolkit:TurnstileTransition Mode="BackwardIn"/>
            </toolkit:NavigationInTransition.Backward>
            <toolkit:NavigationInTransition.Forward>
                <toolkit:TurnstileTransition Mode="ForwardIn"/>
            </toolkit:NavigationInTransition.Forward>
        </toolkit:NavigationInTransition>
    </toolkit:TransitionService.NavigationInTransition>
    <toolkit:TransitionService.NavigationOutTransition>
        <toolkit:NavigationOutTransition>
            <toolkit:NavigationOutTransition.Backward>
                <toolkit:TurnstileTransition Mode="BackwardOut"/>
            </toolkit:NavigationOutTransition.Backward>
            <toolkit:NavigationOutTransition.Forward>
                <toolkit:TurnstileTransition Mode="ForwardOut"/>
            </toolkit:NavigationOutTransition.Forward>
        </toolkit:NavigationOutTransition>
    </toolkit:TransitionService.NavigationOutTransition>

    <!--Sample code showing usage of ApplicationBar-->
    <phone:PhoneApplicationPage.ApplicationBar >
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True" BackgroundColor="{StaticResource ApplicationBarBGColor}" ForegroundColor="{StaticResource ApplicationBarFGColor}">
            <shell:ApplicationBarIconButton IconUri="/Images/ApplicationBar/appbar.add.rest.png" Text="添加" />
            <shell:ApplicationBarIconButton  IconUri="/Images/ApplicationBar/appbar.save.rest.png" Text="保存"/>
<shell:ApplicationBarIconButton  IconUri="/Images/ApplicationBar/appbar.sync.rest.png" Text="导入导出数据"/>
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>
 
        <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" RenderTransformOrigin="0.5,0.5" Background="{StaticResource BackgroudBrush}" >
    	<Grid.RowDefinitions>
    		<RowDefinition Height="656"/>
    		<RowDefinition Height="72"/>
    	</Grid.RowDefinitions>
     
            <!--Panorama Control-->
        <controls:Panorama x:Name="_rootPanorama"  Foreground="{StaticResource TitleForeColor}" Margin="0,-2,0,9" SelectionChanged="Panorama_SelectionChanged">
         <controls:Panorama.Title><TextBlock FontSize="96"><TextBlock.Foreground>
		<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
			<GradientStop Color="Transparent" Offset="0.038"/>
			<GradientStop Color="#63FFFFFF" Offset="1"/>
		</LinearGradientBrush>
	</TextBlock.Foreground><Run Text="艰难决定：午饭吃啥"/></TextBlock></controls:Panorama.Title>

		    <controls:PanoramaItem Header="想吃点啥" Foreground="{StaticResource ForeColor}" Style="{StaticResource PanoramaItemStyle1}">
                <!--Double line 	
				list with text wrapping-->
                <!--Double line 
				list with text wrapping-->
                <ListBox x:Name="WhatToEat" Margin="0,0,0,-30" ItemsSource="{Binding Places}" BorderBrush="{StaticResource PhoneBorderBrush}" Projection="{StaticResource ListProjection}" >
	                <ListBox.ItemTemplate>
                        <DataTemplate>
                            <CheckBox IsChecked="{Binding Chosen, Mode=TwoWay}" Foreground="{StaticResource ForeColor}" Style="{StaticResource BowCheckBox}">
                                <toolkit:ContextMenuService.ContextMenu>
                                    <toolkit:ContextMenu Background="{StaticResource DarkBorderBrush}" BorderBrush="{StaticResource ForeColor}" Foreground="{StaticResource ForeColor}">
                                        <toolkit:MenuItem
								            Header="　　　　编辑" Command="{Binding MainViewModel.EditItemCommand}"  BorderBrush="{StaticResource ForeColor}" CommandParameter="{Binding Mode=OneWay}" Foreground="{StaticResource ForeColor}"
								            />
                                        <toolkit:MenuItem
								            Header="　　　　删除" Command="{Binding MainViewModel.RemoveItemCommand}"  BorderBrush="{StaticResource ForeColor}" CommandParameter="{Binding Mode=OneWay}" Foreground="{StaticResource ForeColor}"
								            />
                                        <toolkit:MenuItem
								            Header="　　　　全选" Command="{Binding MainViewModel.SelectAllCommand}" CommandParameter="{Binding Mode=OneWay}" Foreground="{StaticResource ForeColor}"
								            />
                                    </toolkit:ContextMenu>
                                </toolkit:ContextMenuService.ContextMenu>
                                <StackPanel  Width="454" >
                                    <TextBlock Text="{Binding Name}"  TextWrapping="Wrap" Style="{StaticResource MyPhoneTextExtraLargeStyle}" HorizontalAlignment="Left" />

                                    <TextBlock Text="{Binding Description}" TextWrapping="Wrap"  Style="{StaticResource MyPhoneTextSubtleStyle}" HorizontalAlignment="Left" Width="442"/>

                                </StackPanel>
                            </CheckBox>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
            </controls:PanoramaItem>
            <controls:PanoramaItem Header="跟谁吃点啥" Foreground="{StaticResource ForeColor}" Style="{StaticResource PanoramaItemStyle1}">
                <!--Triple line list no text wrapping-->
                <ListBox x:Name="WhoToWith" Margin="0,0,0,-30" ItemsSource="{Binding Person}" Projection="{StaticResource ListProjection}">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <CheckBox IsChecked="{Binding Chosen, Mode=TwoWay}" Style="{StaticResource BowCheckBox}">
                                <StackPanel  Width="454" >
                                    <toolkit:ContextMenuService.ContextMenu >
                                        <toolkit:ContextMenu Foreground="{StaticResource ForeColor}" BorderBrush="{StaticResource ForeColor}" Background="{StaticResource DarkBorderBrush}">
                                            <toolkit:MenuItem
												Header="　　　　删除" Command="{Binding MainViewModel.RemoveItemCommand}" Foreground="{StaticResource ForeColor}" CommandParameter="{Binding Mode=OneWay}"
												/>
                                            <toolkit:MenuItem
								Header="　　　　全选" Command="{Binding MainViewModel.SelectAllCommand}"  Foreground="{StaticResource ForeColor}" CommandParameter="{Binding Mode=OneWay}"
								/>
                                        </toolkit:ContextMenu>
                                    </toolkit:ContextMenuService.ContextMenu>
                                    <TextBlock Text="{Binding Name}" TextWrapping="Wrap" Style="{StaticResource PhoneTextExtraLargeStyle}" HorizontalAlignment="Left" Foreground="{StaticResource ForeColor}" />
                                    <TextBlock Text="{Binding Phone}" TextWrapping="Wrap"  Style="{StaticResource PhoneTextSubtleStyle}" HorizontalAlignment="Left" Width="442" Foreground="{StaticResource ForeColorLight}"/>



                                </StackPanel>
                            </CheckBox>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
            </controls:PanoramaItem>
            <controls:PanoramaItem Header="决定！" Foreground="{StaticResource ForeColor}" Style="{StaticResource PanoramaItemStyle1}">
                <!--Triple line list no text wrapping-->
                <Grid Margin="0,-21,0,0" >

        
            	
            		        <local:Decide DataContext="{Binding}" />
        	
			   
			
                </Grid>
            </controls:PanoramaItem>
            <controls:PanoramaItem Header="历史" Foreground="{StaticResource ForeColor}" Style="{StaticResource PanoramaItemStyle1}">
            		
                <!--Triple line list no text wrapping-->
                <ListBox x:Name="History" Margin="0" ItemsSource="{Binding Histories}">
                    <ListBox.Resources>
                        <ItemsPanelTemplate x:Key="ItemsPanelTemplate2">
                            <StackPanel VerticalAlignment="Bottom" />
                        </ItemsPanelTemplate>
                    </ListBox.Resources>
                	<ListBox.Foreground>
                		<StaticResource ResourceKey="ForeColor"/>
                	</ListBox.Foreground>
                    <ListBox.ItemsPanel>
                        <StaticResource ResourceKey="ItemsPanelTemplate2"/>
                    </ListBox.ItemsPanel>
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <StackPanel Margin="0,0,0,17">
                                <TextBlock Text="{Binding Date}" TextWrapping="NoWrap" Margin="12,0,0,0" Foreground="{StaticResource ForeColor}"  />

                                <TextBlock Text="{Binding Place}" TextWrapping="NoWrap" Margin="12,0,0,0" Foreground="{StaticResource ForeColor}"  />
                                <ListBox    ItemsSource="{Binding Person}" ItemsPanel="{StaticResource WarpItemsPanelTemplate}" Margin="20" Foreground="{StaticResource ForeColor}" >
                                    <ListBox.ItemTemplate >
                                        <DataTemplate>
                                            <TextBlock Foreground="{StaticResource ForeColor}" Margin="4,0,4,0" Text="{Binding Name}" FontSize="28" TextDecorations="Underline"/>
                                        </DataTemplate>
                                    </ListBox.ItemTemplate>

                                </ListBox>
                            </StackPanel>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
            </controls:PanoramaItem>
            <controls:PanoramaItem Header="关于" Foreground="{StaticResource ForeColor}" Style="{StaticResource PanoramaItemStyle1}">

            	
            		<ListBox >
                    <Button BorderThickness="0"  VerticalAlignment="Stretch" Command="{Binding GetPaidCommand}" Visibility="Collapsed">
                        更新到无广告版本
                    </Button>
                        <Grid Margin="23,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Center"	>
                	<Grid.Background>
                		<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                			<GradientStop Color="#34FFFFFF" Offset="0.004"/>
                			<GradientStop Color="#47FFFFFF" Offset="1"/>
                		</LinearGradientBrush>
                	</Grid.Background>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="0.285*"/>
                        <ColumnDefinition Width="0.715*"/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="0.07*"/>
                        <RowDefinition Height="0.07*"/>
                        <RowDefinition Height="0.07*"/>
                        <RowDefinition Height="0.07*"/>
                        <RowDefinition Height="0.07*"/>
                        <RowDefinition Height="0.433*"/>
                    </Grid.RowDefinitions>
                    <TextBlock  TextWrapping="Wrap" Text="版本：" HorizontalAlignment="Right" Margin="0,0,12,0" Foreground="{StaticResource ForeColor}"/>
                    <TextBlock  TextWrapping="Wrap" Text="作者：" Grid.Row="1" HorizontalAlignment="Right" Margin="0,0,12,0" Foreground="{StaticResource ForeColor}"/>
                    <TextBlock  TextWrapping="Wrap" Text="邮件：" Grid.Row="2" HorizontalAlignment="Right" Margin="0,0,12,0" VerticalAlignment="Top" Foreground="{StaticResource ForeColor}"/>
                    <TextBlock  TextWrapping="Wrap" Text="新浪微博：" Grid.Row="3" HorizontalAlignment="Right" Margin="0,0,12,0" VerticalAlignment="Top" Foreground="{StaticResource ForeColor}"/>
                    <TextBlock  TextWrapping="Wrap" Text="Twitter：" Grid.Row="4" HorizontalAlignment="Right" Margin="0,0,12,0" Foreground="{StaticResource ForeColor}"/>
                    <TextBlock  TextWrapping="Wrap" Grid.Row="5" HorizontalAlignment="Right" Margin="0,0,12,0" Foreground="{StaticResource ForeColor}" Text="更新内容："/>
                    <TextBlock TextWrapping="Wrap" Grid.Row="0" Grid.Column="1" Foreground="{StaticResource ForeColor}" Text="{Binding Setting.CurrentVersionNum}" />
                    <TextBlock TextWrapping="Wrap" Text="韦恩卑鄙" Grid.Row="1" Grid.Column="1" Foreground="{StaticResource ForeColor}" />
                    <Button BorderThickness="0" Grid.Row="2" Grid.Column="1" HorizontalAlignment="Left"  FontSize="{StaticResource PhoneFontSizeSmall}" Command="{Binding OpenIECommand}" 
					CommandParameter="mailto:blackshaman_wayne@hotmail.com" Margin="0,0,0,0" Foreground="{StaticResource ForeColor}" Style="{StaticResource LinkButton}" Width="289" FontFamily="Andalus" Content="blackshaman_wayne@hotmail.com" />
                    <Button BorderThickness="0" Grid.Row="3" Grid.Column="1" HorizontalAlignment="Left" FontSize="{StaticResource PhoneFontSizeSmall}"  Command="{Binding OpenIECommand}" 
					CommandParameter="http://weibo.com/waynebabywang" Margin="0" VerticalAlignment="Top" Grid.RowSpan="2" Foreground="{StaticResource ForeColor}" Style="{StaticResource LinkButton}" Content="@韦恩卑鄙"/>
                    <Button BorderThickness="0" Grid.Row="4" Grid.Column="1" HorizontalAlignment="Left" FontSize="{StaticResource PhoneFontSizeSmall}" Command="{Binding OpenIECommand}" 
					CommandParameter="https://twitter.com/waynebaby"  Margin="0" VerticalAlignment="Top" Grid.RowSpan="4" Foreground="{StaticResource ForeColor}" Style="{StaticResource LinkButton}" FontFamily="Andalus" Content="@waynebaby"/>
                    <TextBlock TextWrapping="Wrap" Grid.Row="5" Grid.Column="1" Margin="0,22,0,11" Foreground="{StaticResource ForeColor}" Text="{Binding Setting.WhatsNewThisVersion}" />

                </Grid></ListBox>
				
            </controls:PanoramaItem>
        </controls:Panorama>
        <toolkit:ToggleSwitch HorizontalAlignment="Left"  VerticalAlignment="Top" FontSize="16" Foreground="{StaticResource ForeColor}" IsChecked="{Binding IsGeoStarted, Mode=TwoWay}" Margin="0,48,0,0" Width="369">
            <TextBlock Text="{Binding GeoPositionStateMessage}" />
        </toolkit:ToggleSwitch>
        <StackPanel Grid.Row="1" Name="AdConatiner" >
      
        </StackPanel>
    </Grid>

</phone:PhoneApplicationPage>